package com.qf.controller;

import com.qf.pojo.Citys;
import com.qf.pojo.Msg;
import com.qf.pojo.Orders;
import com.qf.service.CarsService;
import com.qf.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/city")
public class CityController {
    @Autowired
  private CityService cityService;


    @RequestMapping("/select.do")
    @ResponseBody
    public Msg selAll(int pid){

        List<Citys> clist = cityService.seleAll(pid);
        Msg<Object> m = new Msg<>();
        m.setData(clist);
        return m;
    }
    @RequestMapping("/citys.do")
    @ResponseBody
    public Msg selcityById(int getid,int backid){
        Citys getcity = cityService.selcityById(getid);
        Citys backcity=cityService.selcityById(backid);
        Orders orders = new Orders();
        orders.setGetCity(getcity);
        orders.setBackCity(backcity);
        Msg<Object> m = new Msg<>();
        m.setData(orders);
        m.setCode(1);
        return m;
    }

}
